#include "Panel.h"


namespace Zaf {
namespace Mwl {



Panel::Panel() {
	CommonConstructor();
}



Panel::Panel(WORD id) : ControlWindow(id) {
	CommonConstructor();
}



void Panel::CommonConstructor() {
	ChangeExStyle(WS_EX_CONTROLPARENT, true);
}



Panel::~Panel() {

}



HWND Panel::CreateConcreteWindow() {

	unsigned int x;
	unsigned int y;
	GetPosition(x, y);

	unsigned int width;
	unsigned int height;
	GetSize(width, height);

	return CreateWindowEx(
		GetExStyle(),
		L"#32770",
		GetText().c_str(),
		GetStyle(),
		x, 
		y,
		width,
		height,
		GetParentOrOwner(),
		(HMENU)GetID(),
		GetModuleHandle(nullptr),
		0
	);
}



LRESULT Panel::WndProc(const WndMsg& msg) {

	if (msg.Message == WM_CTLCOLORDLG) {

		return (LRESULT)GetStockObject(NULL_BRUSH);
	}

	return ControlWindow::WndProc(msg);
}



LRESULT Panel::DefWndProc(const WndMsg& msg) {
	return ::CallWindowProc(DefDlgProc, msg.Hwnd, msg.Message, msg.WParam, msg.LParam);
}


}
}